
#include "downbullet.h"

DownBullet::DownBullet() {

    //子弹初始坐标
    b_X=GAME_WIDTH/2-b_Bullet.width();
    b_Y=GAME_HEIGHT;
    //子弹状态
    b_Free=true;
    //子弹速度
    b_Speed=BULLET_SPEED;
    //子弹边框
    b_Rect.setWidth(b_Bullet.width());
    b_Rect.setHeight(b_Bullet.height());
    b_Rect.moveTo(b_X,b_Y);


}
void DownBullet::updatePosition(){
    if(b_Free){
        return;
    }
    //子弹向上移动
    b_Y-=b_Speed;
    b_Rect.moveTo(b_X,b_Y);
    //子弹超出区域
    if(b_Y<=-b_Bullet.height()){
        b_Free=true;
    }
}
